import java.util.Comparator;
import java.util.PriorityQueue;

public class TestPriorityQueue {

    static class MyCmpSmall implements Comparator<Integer>{

        @Override
        public int compare(Integer o1, Integer o2) {
            return o1 - o2;
        }
    }
    static class MyCmpBig implements Comparator<Integer>{

        @Override
        public int compare(Integer o1, Integer o2) {
            return o2 - o1;
        }
    }
    public static int[] smallestK(int[] arr, int k) {
        if(arr == null || k == 0){
            return new int[0];
        }

        PriorityQueue<Integer> ret = new PriorityQueue<>(arr.length,new MyCmpBig());

        for (int i = 0; i < k; i++) {
            ret.offer(arr[i]);
        }
        for (int i = k; i <arr.length ; i++) {
            if(arr[i] < ret.peek()){
                ret.poll();
                ret.offer(arr[i]);
            }
        }
        int[] retArr = new int[k];
        for (int i = 0; i < k; i++) {
            retArr[i] = ret.poll();
        }
        return retArr;
    }

    public static void main(String[] args) {
        Card card1 = new Card(4,"hongtao");
        Card card2 = new Card(5,"heitao");
        if(card1.compareTo(card2) > 0) {
            System.out.println("card1 > card2");
        }else {
            System.out.println("card1 <= card2");
        }
        System.out.println("======");
        SuitComparator suitComparator = new SuitComparator();
        if(suitComparator.compare(card1,card2) > 0) {
            System.out.println("card1 > card2");
        }else {
            System.out.println("card1 <= card2");
        }
    }
    public static void TestPriorityQueue()
    {
        PriorityQueue<Card> p = new PriorityQueue<>();
        p.offer(new Card(1, "♠"));
        p.offer(new Card(2, "♠"));
    }
    public static void main1(String[] args) {
        TestPriorityQueue();

    }
}